import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter);


//懒加载
const Home = () =>
    import ('../views/home/Home');
const Search = () =>
    import ('../views/search/Search');
const My = () =>
    import ('../views/about/My');
const Cart = () =>
    import ('../views/cart/Cart');
const DetailPages = () =>
    import ('../views/detail/DetailPages')


const routes = [{
        path: '/',
        redirect: '/home'
    }, {
        path: '/home',
        component: Home,
    },
    {
        path: '/about',
        component: My
    },
    {
        path: '/search',
        component: Search
    },
    {
        path: '/cart',
        component: Cart
    },
    {
        path: '/detail/:iid',
        component: DetailPages
    }
];


const router = new VueRouter({
    routes,
    mode: 'history'
});
export default router